export const todos = (
  state = [
    { id: 1, text: '吃饭' },
    { id: 2, text: '睡觉' },
  ],
  action
) => {
  console.log('todos==>', state, action);
  // 添加todo
  if (action.type === 'addTodo') {
    return [...state, { id: state.length + 1, text: action.payload }];
  }

  return state;
};
